Skip to content

fix: fill missing fully qualified syntax in prompt_handler macros#866

Merged
alexhancock merged 3 commits into
modelcontextprotocol:mainfrom
moroviintaas:fix_ufcs_prompt_handler
Jun 26, 2026
Merged

fix: fill missing fully qualified syntax in prompt_handler macros#866
alexhancock merged 3 commits into
modelcontextprotocol:mainfrom
moroviintaas:fix_ufcs_prompt_handler

Conversation

@moroviintaas

Copy link
Copy Markdown
Contributor

Motivation and Context

Some syntax generated by macro #[prompt_handler] was not fully qualified.
I needed to use them in my user code, so the macro does not break. This include:

  • rmcp::model::GetPromptResult
  • rmcp::modelListPromptsResult
  • rmcp::model::PaginatedRequestParams
  • rmcp::RoleServer
  • rmcp::service::RequestContext

How Has This Been Tested?

  1. Modified locally examples/servers/src/common/counter.rs, removing imports from rmcp - fully qualified broken idents in examples.
  2. Checked that build fails, because missing types with hint to import them.
 cargo test --workspace --examples --features server --features client
  1. Applied this fix.
  2. Checked that tests finish with success:
cargo test --workspace --examples --features server --features client

Breaking Changes

This commit probably does not introduce braking changes.
I haven't changed macros that use McpError, which is then imported in examples with rmcp::ErrorData as McpError.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

It seems there are still some macro code that forces user to import:

use rmcp::ErrorData as McpError

but I am not sure if fixing it would not be a breaking change.

@moroviintaas moroviintaas requested a review from a team as a code owner June 1, 2026 13:16
@github-actions github-actions Bot added the T-macros Macro changes label Jun 1, 2026

@DaleSeo DaleSeo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moroviintaas The fix looks good but could you please remove the unused imports from the test? Thanks!

Image

@github-actions github-actions Bot added the T-test Testing related changes label Jun 26, 2026
@alexhancock alexhancock self-requested a review June 26, 2026 16:38
@alexhancock alexhancock merged commit 4158528 into modelcontextprotocol:main Jun 26, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-macros Macro changes T-test Testing related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants